package com.zhkj.txg.module.mine.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.txg.R
import com.zhkj.txg.module.mine.entity.CollectionShopGoodsEntity
import com.zhkj.txg.module.product.ui.ProductDetailActivity
import com.zhkj.txg.utils.ImageUtils

class CollectionShopGoodsAdapter :
    BaseQuickAdapter<CollectionShopGoodsEntity, BaseViewHolder>(R.layout.item_collection_shop_goods) {

    init {
        setOnItemClickListener { _, _, position ->
            ProductDetailActivity.normalProduct(context, data[position].id.toInt())
        }
    }

    override fun convert(helper: BaseViewHolder, item: CollectionShopGoodsEntity) {
        val imageView = helper.getView<ImageView>(R.id.ivCollectShopGoods)
        ImageUtils.loadRoundCornerImage(context, imageView, item.image)
    }
}